package com.open.demo.apm

import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import android.util.Printer

/**
 *
 */
object ApmHandlerThread {

    var handler: Handler? = null
    val defaultHandlerThread:HandlerThread by lazy {
        val ht = HandlerThread("ApmHandlerThread")
        ht.start()
        handler = Handler(ht.looper)
        ht.looper.setMessageLogging(LooperPrinter())
        ht
    }

    class LooperPrinter : Printer {
        override fun println(x: String?) {
            Log.d("ApmHandlerThread", "println x:$x")
        }
    }

}